home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / LocationManager.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  10.0 KB  |  321 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        LocationManager.p
  3.  
  4.      Contains:    LocationManager (manages groups of settings)
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT LocationManager;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __LOCATIONMANAGER__}
  27. {$SETC __LOCATIONMANAGER__ := 1}
  28.  
  29. {$I+}
  30. {$SETC LocationManagerIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __APPLEEVENTS__}
  34. {$I AppleEvents.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __COMPONENTS__}
  37. {$I Components.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __DIALOGS__}
  40. {$I Dialogs.p}
  41. {$ENDC}
  42. {$IFC UNDEFINED __PROCESSES__}
  43. {$I Processes.p}
  44. {$ENDC}
  45. {$IFC UNDEFINED __STANDARDFILE__}
  46. {$I StandardFile.p}
  47. {$ENDC}
  48.  
  49.  
  50. {$PUSH}
  51. {$ALIGN MAC68K}
  52. {$LibExport+}
  53.  
  54. {  Location Manager API Support --------------------------------------------------------------------  }
  55. {  A Location Token uniquely identifies a Location on a machine...  }
  56.  
  57.  
  58. TYPE
  59.     ALMToken = ^LONGINT;
  60.  
  61. CONST
  62.     kALMNoLocationToken            = -1;                            {  ALMToken of "off" Location... }
  63.  
  64.     kALMLocationNameMaxLen        = 31;                            {  name (actually imposed by file system)...  }
  65.     kALMNoLocationIndex            = -1;                            {  index for the "off" Location (kALMNoLocationToken)...  }
  66.  
  67.  
  68. TYPE
  69.     ALMLocationName                        = Str31;
  70. {  Returned from ALMConfirmName...  }
  71.     ALMConfirmChoice                    = SInt16;
  72.  
  73. CONST
  74.     kALMConfirmRename            = 1;
  75.     kALMConfirmReplace            = 2;
  76.  
  77. {  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)...  }
  78.  
  79.     kALMDuplicateRenameButton    = 1;                            {  if Window refcon is kALMDuplicateDialogRefCon...  }
  80.     kALMDuplicateReplaceButton    = 2;
  81.     kALMDuplicateCancelButton    = 3;
  82.     kALMDuplicatePromptText        = 5;
  83.  
  84.     kALMRenameRenameButton        = 1;                            {  if Window refcon is kALMRenameDialogRefCon...  }
  85.     kALMRenameCancelButton        = 2;
  86.     kALMRenameEditText            = 3;
  87.     kALMRenamePromptText        = 4;
  88.  
  89. {  Refcons of two windows in ALMConfirmName (ALM 2.0)...  }
  90.  
  91.     kALMDuplicateDialogRefCon    = 'dupl';
  92.     kALMRenameDialogRefCon        = 'rnam';
  93.  
  94. {  Callback routine for Location awareness (mimics AppleEvents) in non-application code...  }
  95.  
  96.  
  97. TYPE
  98. {$IFC TYPED_FUNCTION_POINTERS}
  99.     ALMNotificationProcPtr = PROCEDURE(VAR theEvent: AppleEvent);
  100. {$ELSEC}
  101.     ALMNotificationProcPtr = ProcPtr;
  102. {$ENDC}
  103.  
  104.     ALMNotificationUPP = UniversalProcPtr;
  105.  
  106. CONST
  107.     uppALMNotificationProcInfo = $000000C0;
  108.  
  109. FUNCTION NewALMNotificationProc(userRoutine: ALMNotificationProcPtr): ALMNotificationUPP;
  110.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  111.     INLINE $2E9F;
  112.     {$ENDC}
  113.  
  114. PROCEDURE CallALMNotificationProc(VAR theEvent: AppleEvent; userRoutine: ALMNotificationUPP);
  115.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  116.     INLINE $205F, $4E90;
  117.     {$ENDC}
  118. {  Notification AppleEvents sent to apps/registered code...   }
  119.  
  120. CONST
  121.     kAELocationChangedNoticeKey    = 'walk';                        {  Current Location changed...  }
  122.     kAELocationRescanNoticeKey    = 'trip';                        {  Location created/renamed/deleted...  }
  123.  
  124. {  ALMSwitchToLocation masks...  }
  125.  
  126.  
  127. TYPE
  128.     ALMSwitchActionFlags                = SInt32;
  129.  
  130. CONST
  131.     kALMDefaultSwitchFlags        = $00000000;                    {  No special action to take...  }
  132.     kALMDontShowStatusWindow    = $00000001;                    {  Suppress "switching" window...  }
  133.     kALMSignalViaAE                = $00000002;                    {  Switch by sending Finder AppleEvent...  }
  134.  
  135. {  Parameters for Get/Put/Merge Location calls...  }
  136.  
  137.  
  138. TYPE
  139.     ConstALMModuleTypeListPtr            = ^OSType;
  140.  
  141. CONST
  142.     kALMAddAllOnSimple            = 0;                            {  Add all single-instance, non-action modules...  }
  143.     kALMAddAllOff                = -1;                            {  Add all modules but turn them off...  }
  144.  
  145. {  Item numbers for use in Get/Put/Merge Location filters...  }
  146.  
  147.     kALMLocationSelectButton    = 1;
  148.     kALMLocationCancelButton    = 2;
  149.     kALMLocationBalloonHelp        = 3;
  150.     kALMLocationLocationList    = 7;
  151.     kALMLocationLocationNameEdit = 10;
  152.     kALMLocationPromptText        = 11;
  153.  
  154.     kALMLocationSaveButton        = 1;
  155.  
  156. {  Location Manager Module API Support -------------------------------------------------------------  }
  157.  
  158. {  ALMGetScriptInfo stuff...  }
  159.  
  160.     kALMScriptInfoVersion        = 2;                            {  Customarily put in resource for localization...  }
  161.  
  162.  
  163. TYPE
  164.     ALMScriptManagerInfoPtr = ^ALMScriptManagerInfo;
  165.     ALMScriptManagerInfo = RECORD
  166.         version:                SInt16;                                    {  Set to kALMScriptInfoVersion...  }
  167.         scriptCode:                SInt16;
  168.         regionCode:                SInt16;
  169.         langCode:                SInt16;
  170.         fontNum:                SInt16;
  171.         fontSize:                SInt16;
  172.     END;
  173.  
  174. {
  175.    Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  176.    samples and internally, so....
  177. }
  178.     ALMAltScriptManagerInfoPtr = ^ALMAltScriptManagerInfo;
  179.     ALMAltScriptManagerInfo = RECORD
  180.         version:                SInt16;
  181.         scriptCode:                SInt16;
  182.         regionCode:                SInt16;
  183.         langCode:                SInt16;
  184.         fontSize:                SInt16;
  185.         fontName:                Str63;
  186.     END;
  187.  
  188.     ALMAltScriptManagerInfoHandle        = ^ALMAltScriptManagerInfoPtr;
  189.  
  190. CONST
  191.     kALMAltScriptManagerInfoRsrcType = 'trip';
  192.     kALMAltScriptManagerInfoRsrcID = 0;
  193.  
  194. {  Reboot information used on ALMSetCurrent (input/output parameter)...  }
  195.  
  196.  
  197. TYPE
  198.     ALMRebootFlags                        = UInt32;
  199.  
  200. CONST
  201.     kALMNoChange                = 0;
  202.     kALMAvailableNow            = 1;
  203.     kALMFinderRestart            = 2;
  204.     kALMProcesses                = 3;
  205.     kALMExtensions                = 4;
  206.     kALMWarmBoot                = 5;
  207.     kALMColdBoot                = 6;
  208.     kALMShutdown                = 7;
  209.  
  210. {
  211.    File types and signatures...
  212.    Note: auto-routing of modules will not be supported for 'thng' files...
  213. }
  214.  
  215.     kALMFileCreator                = 'fall';                        {  Creator of Location Manager files...  }
  216.     kALMComponentModuleFileType    = 'thng';                        {  Type of a Component Manager Module file [v1.0]...  }
  217.     kALMComponentStateModuleFileType = 'almn';                    {  Type of a CM 'state' Module file...  }
  218.     kALMComponentActionModuleFileType = 'almb';                    {  Type of a CM 'action' Module file...  }
  219.     kALMCFMStateModuleFileType    = 'almm';                        {  Type of a CFM 'state' Module file...  }
  220.     kALMCFMActionModuleFileType    = 'alma';                        {  Type of a CFM 'action' Module file...  }
  221.  
  222. {  Component Manager 'thng' info...  }
  223.  
  224.     kALMComponentRsrcType        = 'thng';
  225.     kALMComponentType            = 'walk';
  226.  
  227. {  CFM Modules require a bit of information (replacing some of the 'thng' resource)...  }
  228.  
  229.     kALMModuleInfoRsrcType        = 'walk';
  230.     kALMModuleInfoOriginalVersion = 0;
  231.  
  232. {  These masks apply to the "Flags" field in the 'thng' or 'walk' resource...  }
  233.  
  234.     kALMMultiplePerLocation        = $00000001;                    {  Module can be added more than once to a Location...  }
  235.     kALMDescriptionGetsStale    = $00000002;                    {  Descriptions may change though the setting didn't...   }
  236.  
  237. {  Misc stuff for older implementations ------------------------------------------------------------  }
  238.  
  239. {$IFC OLDROUTINENAMES }
  240. {  Old error codes for compatibility - new names are in Errors interface...  }
  241.     ALMInternalErr                = -30049;                        {  use kALMInternalErr  }
  242.     ALMLocationNotFound            = -30048;                        {  use kALMLocationNotFoundErr  }
  243.     ALMNoSuchModuleErr            = -30047;                        {  use kALMNoSuchModuleErr  }
  244.     ALMModuleCommunicationErr    = -30046;                        {  use kALMModuleCommunicationErr  }
  245.     ALMDuplicateModuleErr        = -30045;                        {  use kALMDuplicateModuleErr  }
  246.     ALMInstallationErr            = -30044;                        {  use kALMInstallationErr  }
  247.     ALMDeferSwitchErr            = -30043;                        {  use kALMDeferSwitchErr  }
  248.  
  249. {  Old ALMConfirmName constants...  }
  250.  
  251.     ALMConfirmRenameConfig        = 1;
  252.     ALMConfirmReplaceConfig        = 2;
  253.  
  254. {  Old AppleEvents...  }
  255.  
  256.     kAELocationNotice            = 'walk';
  257.  
  258.  
  259. TYPE
  260.     ALMScriptMgrInfo                    = ALMScriptManagerInfo;
  261.     ALMScriptMgrInfoPtr                 = ^ALMScriptMgrInfo;
  262.     ALMComponentFlagsEnum                = UInt32;
  263. {$ENDC}  {OLDROUTINENAMES}
  264.  
  265. {  Location Manager API ----------------------------------------------------------------------------  }
  266.  
  267. {  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set...  }
  268.  
  269. FUNCTION ALMGetCurrentLocation(VAR index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  270.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  271.     INLINE $303C, $0600, $AAA4;
  272.     {$ENDC}
  273. FUNCTION ALMGetIndLocation(index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  274.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  275.     INLINE $303C, $0501, $AAA4;
  276.     {$ENDC}
  277. FUNCTION ALMCountLocations(VAR locationCount: SInt16): OSErr;
  278.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  279.     INLINE $303C, $0202, $AAA4;
  280.     {$ENDC}
  281. FUNCTION ALMSwitchToLocation(newLocation: ALMToken; switchFlags: ALMSwitchActionFlags): OSErr;
  282.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  283.     INLINE $303C, $0403, $AAA4;
  284.     {$ENDC}
  285. FUNCTION ALMRegisterNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  286.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  287.     INLINE $303C, $0404, $AAA4;
  288.     {$ENDC}
  289. FUNCTION ALMRemoveNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  290.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  291.     INLINE $303C, $0405, $AAA4;
  292.     {$ENDC}
  293. FUNCTION ALMConfirmName(message: Str255; VAR theName: Str255; VAR choice: ALMConfirmChoice; filter: ModalFilterUPP): OSErr;
  294.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  295.     INLINE $303C, $0806, $AAA4;
  296.     {$ENDC}
  297. {  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set...  }
  298.  
  299. FUNCTION ALMPutLocation(prompt: Str255; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  300.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  301.     INLINE $303C, $0B07, $AAA4;
  302.     {$ENDC}
  303. FUNCTION ALMGetLocation(prompt: Str255; VAR name: ALMLocationName; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  304.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  305.     INLINE $303C, $0808, $AAA4;
  306.     {$ENDC}
  307. FUNCTION ALMMergeLocation(prompt: Str255; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  308.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  309.     INLINE $303C, $0B09, $AAA4;
  310.     {$ENDC}
  311. {$ALIGN RESET}
  312. {$POP}
  313.  
  314. {$SETC UsingIncludes := LocationManagerIncludes}
  315.  
  316. {$ENDC} {__LOCATIONMANAGER__}
  317.  
  318. {$IFC NOT UsingIncludes}
  319.  END.
  320. {$ENDC}
  321.